package com.shy.condition_db;

import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.type.AnnotatedTypeMetadata;

public class MySqlCondition implements Condition {
    @Override
    public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {

        boolean ret ;
        try {
            context.getClassLoader().loadClass("com.mysql.cj.MysqlConnection");
            ret = true;
        } catch (ClassNotFoundException e) {
            ret = false;
        }
        return ret;
    }
}
